package com.leyou.search.web;


import com.leyou.search.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/index")
public class SaleableController {

    @Autowired
    private IndexService indexService;

    /**
     * 专门被item-service调用服务，s商品的上下架请求时，当saleable为true时表示上架新增，false为下架
     * @param saleable
     * @param id
     * @return
     */
    @RequestMapping("/{saleable}/{id}")
    public ResponseEntity<Void> modifyGoods(@PathVariable("saleable")Boolean saleable,@PathVariable("id")Long id) {
        this.indexService.modifyGoods(saleable,id);
        return ResponseEntity.ok().build();
    }
}
